package com.example.testhilt.module

import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.android.components.ApplicationComponent
import retrofit2.Retrofit

/**
 ********************************************************
 *Author: chinadragon
 *Time: 2020/11/24 4:03 PM
 *Name:不支持的入口点怎么办？
 *Overview:
 *  https://mp.weixin.qq.com/s/OEX1d2cU1zGG5BBM-nANBg
 *Usage:
 ********************************************************
 */
class MyContentProvider : ContentProvider() {
    @EntryPoint
    @InstallIn(ApplicationComponent::class)
    interface MyEntryPoint {
        fun getRetrofit(): Retrofit
    }

    override fun onCreate(): Boolean {
        TODO("Not yet implemented")
    }

    override fun query(
        p0: Uri,
        p1: Array<out String>?,
        p2: String?,
        p3: Array<out String>?,
        p4: String?
    ): Cursor? {
        TODO("Not yet implemented")
    }

    /*override fun query(
        p0: Uri,
        p1: Array<out String>?,
        p2: String?,
        p3: Array<out String>?,
        p4: String?
    ): Cursor? {

    *//*
        context?.let {
            var appContext = it.applicationContext
            var entryPoint = EntryPointAccessors.fromApplication(appContext, MyEntryPoint::class.java)
            var retrofit = entryPoint.getRetrofit()

        }*//*
    }*/

    override fun getType(p0: Uri): String? {
        TODO("Not yet implemented")
    }

    override fun insert(p0: Uri, p1: ContentValues?): Uri? {
        TODO("Not yet implemented")
    }

    override fun delete(p0: Uri, p1: String?, p2: Array<out String>?): Int {
        TODO("Not yet implemented")
    }

    override fun update(p0: Uri, p1: ContentValues?, p2: String?, p3: Array<out String>?): Int {
        TODO("Not yet implemented")
    }

}